package io.renren.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.renren.commons.mybatis.service.impl.CrudServiceImpl;
import io.renren.dao.RepairNotepadDao;
import io.renren.dto.RepairNotepadDTO;
import io.renren.entity.RepairNotepadEntity;
import io.renren.service.RepairNotepadService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * 维修记录
 *
 * @author liuyujun 384880231@qq.com
 * @since 3.0 2022-01-13
 */
@Service
public class RepairNotepadServiceImpl extends CrudServiceImpl<RepairNotepadDao, RepairNotepadEntity, RepairNotepadDTO> implements RepairNotepadService {

    @Override
    public QueryWrapper<RepairNotepadEntity> getWrapper(Map<String, Object> params){
        QueryWrapper<RepairNotepadEntity> wrapper = new QueryWrapper<>();

        String srcid = (String)params.get("srcid");
        wrapper.eq(StringUtils.isNotBlank(srcid), "srcid", srcid);
        String contacts = (String)params.get("contacts");
        wrapper.like(StringUtils.isNotBlank(contacts), "contacts", contacts);
        String phone = (String)params.get("phone");
        wrapper.like(StringUtils.isNotBlank(phone), "phone", phone);
        String hid = (String)params.get("hid");
        wrapper.like(StringUtils.isNotBlank(hid), "hid", hid);
        String startDateTime = (String)params.get("startDateTime");
        String endDateTime = (String)params.get("endDateTime");
        wrapper.ge(StringUtils.isNotBlank(startDateTime), "appointment_start_time", startDateTime);
        wrapper.le(StringUtils.isNotBlank(endDateTime), "appointment_end_time", endDateTime);

        return wrapper;
    }


}